<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateParkManintenancesTable extends Migration
{
    /**
     * Run the migrations.
     *绿化基础数据->绿植养护信息表
     *
     * @return void
     */
    public function up()
    {
        Schema::create('park_manintenances', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('vegetation_id')->unsigned()->comment('植被信息id')->nullable();
            $table->foreign('vegetation_id')->references('id')->on('park_vegetations')->onDelete('set null');
            $table->string('period')->comment('生长周期');
            $table->integer('department_id')->unsigned()->comment('作业部门id')->nullable(true);
            $table->foreign('department_id')->references('id')->on('departments')->onDelete('set null');
            $table->integer('type')->comment('作业类别 0-修剪 1-松土 2-浇水 3-除草 4-清理绿化垃圾')->default(0);
            $table->string('unit',4)->comment('周期单位 周 日');
            $table->integer('num')->comment('维护周期');
            $table->text('content')->comment('作业内容')->nullable();
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('park_manintenances');
    }
}
